package com.hl.controller;

import com.hl.domain.Questionsreply;
import com.hl.service.serviceImpl.QuestionsReplyServiceImpl;
import com.hl.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

//提问回答
@RequestMapping("/questionsController")
@RestController
public class QuestionsController {
    @Autowired
    private QuestionsReplyServiceImpl questionsReplyServiceImpl;

    @GetMapping("/selectAll")
    public R selectAll(){
        return R.success(questionsReplyServiceImpl.selectAll());
    }

    @GetMapping("/selectLike")
    public R selectLike(String title){
        return R.success(questionsReplyServiceImpl.selectLike(title));
    }

    //    新增
    @PostMapping("/insert")
    public R insert (Questionsreply questionsreply){
        return R.success(questionsReplyServiceImpl.insert(questionsreply));
    }
    //    删除
    @DeleteMapping("/delete")
    public R delete(Long id){
        return R.success(questionsReplyServiceImpl.delete(id));
    }

    //    修改
    @PostMapping("/update")
    public R update(Questionsreply questionsreply){
        return R.success(questionsReplyServiceImpl.update(questionsreply));
    }


}
